{include file="public/header" /}
<div id="dcWrap">
    {include file="public/lefter" /}
    <div id="dcMain">
        <!-- 当前位置 -->
        <div id="urHere">管理中心<b>></b><strong>幻灯广告</strong></div>
        <div class="mainBox" style="height:auto!important;height:550px;min-height:550px;">
            <h3><a href="javascript:;" class="actionBtn">添加幻灯广告</a>幻灯广告</h3>

            <div class="navList">
                <ul class="tab">
                    <li><a href="javascript:;" class="selected" data-flag="ban">Banner大图</a></li>
                    <li><a href="javascript:;" data-flag="adv">广告</a></li>
                </ul>
                <table width="100%" border="0" cellpadding="10" cellspacing="0" class="tableBasic ban">
                    <tr>
                        <th width="10" align="center">ID</th>
                        <th align="center">标题</th>
                        <th width="400" align="center">操作</th>
                    </tr>
                    {volist name="banner" id="ba"}
                    {eq name="ba['type']" value="1"}
                    <tr>
                        <td> {$ba.id}</td>
                        <td align="center"> {$ba.title}</td>
                        <td align="center"><a data-url="{:url('banner/edit',['id' => $ba.id])}" class="btn btn-info edit-flink">编辑</a> <a class="btn" style="cursor: pointer;" href="{:url('banner/banlist',['id' => $ba.id])}">编辑列表</a>  <a class="del btn btn-danger" style="cursor: pointer;" data-id="{$ba.id}">删除</a></td>
                    </tr>
                    {/eq}
                    {/volist}
                </table>
                <table width="100%" border="0" cellpadding="10" cellspacing="0" class="tableBasic adv" style="display: none">
                    <tr>
                        <th width="10" align="center">ID</th>
                        <th align="center">标题</th>
                        <th width="400" align="center">操作</th>
                    </tr>
                    {volist name="banner" id="ba"}
                    {eq name="ba['type']" value="2"}
                    <tr>
                        <td> {$ba.id}</td>
                        <td align="center"> {$ba.title}</td>
                        <td align="center"><a data-url="{:url('banner/edit',['id' => $ba.id])}" class="btn btn-info edit-flink">编 辑</a> <a class="btn" style="cursor: pointer;" href="{:url('banner/banlist',['id' => $ba.id])}">编辑列表</a>  <a class="del btn btn-danger" style="cursor: pointer;" data-id="{$ba.id}">删 除</a></td>
                    </tr>
                    {/eq}
                    {/volist}
                </table>
            </div>
        </div>
    </div>
    <div class="clear"></div>
    {include file="public/footer" /}
    <div class="clear"></div>
</div>
<script type="text/javascript">
    $('.actionBtn').click(function(){
        layer.open({
          title: '添加Banner',
          type: 2,
          area: ['700px', '530px'],
          fixed: false, //不固定
          maxmin: true,
          content: 'add'
        });
    });
    $('.edit-flink').click(function(){
        var url = $(this).data('url');
        layer.open({
          title: '修改Banner',
          type: 2,
          area: ['700px', '530px'],
          fixed: false, //不固定
          maxmin: true,
          content: url
        });
    });
    $(".del").click(function(){
        var id= $(this).data('id');
        var name = $(this).data('name');
        var $this = $(this).parents('tr');
        confirms('','是否确认删除id为【'+ id +'】的幻灯广告？','',function(){
            $.get("{:url('banner/dele')}",{id:id},function(data){
               layer.msg(data.msg,{time: 1000}, function(){
                  if (data.status == 1) {
                    $this.remove();
                  }
                });
            },'json');
        }); 
    })
    //tab
    $('.tab a').click(function(){
        var cls = $(this).data('flag');
        $('.tab a').removeClass('selected');
        $(this).addClass('selected');
        $(".tableBasic ").hide();
        $("." + cls).show();
    });
</script>
</body>
</html>